package cn.tedu.knows.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableZuulProxy
@EnableRedisHttpSession
public class KnowsGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(KnowsGatewayApplication.class, args);
    }

    @Bean
    //@LoadBalanced表示当前这个RestTemplate对象会按照
    //负载均衡的方法调用多个服务器
    @LoadBalanced
    public RestTemplate restTemplate(){
        //RestTemplate就是Ribbon提供的类型
        //它的对象就可以调用到其它微服务的方法
        return new RestTemplate();
    }


}
